import '../static/style/components/advert.css'
import axios from "axios"
import servicePath from '../config/apiUrl'
import React, { useState, useEffect, useContext } from 'react'
const Advert = () => {
  const [imgList, setImgList] = useState([])
  const init = () => {
    axios.post(servicePath.getAllHomeImg).then(res => {
      setImgList(res.data.data)
     
    })
  }
  useEffect(() => {
    init()
  }, [])
  return (
    <div className="ad-div comm-box">

      <div>
        {imgList.map((item) => {
          return <a key={item.id} href="#" target='_blank'>
            <img src={item.url} width="100%" />
          </a>
        })}

      </div>

    </div>
  )
}

export default Advert